package move.field;


/**
 * Created by Administrator on 2018/1/25.
 */
public class Account {

    private AccountType accountType;
    //想要搬移的field
    private double interestRate;


    //第一种方式  直接似乎用accountType
    double interestForAmount_days1(double amount, int days) {
        return accountType.getInterestRate() * amount * days / 365;
    }

    //===================================================
    //第二种方式 使用自封装来进行字段的转移
    double interestForAmount_days2(double amount, int days) {
        return getInterestRate() * amount * days / 365;
    }


    public double getInterestRate() {
        return accountType.getInterestRate();
    }

    public void setInterestRate(double interestRate) {
        accountType.setInterestRate(interestRate);
    }
}
